<?php
/**
 *
 * User: zhaomeng1
 * Date: 2019/5/14
 * Time: 1:13 PM
 *
 * 在线测试websocket
 *http://www.blue-zero.com/WebSocket/
 */
$ws = new swoole_websocket_server("0.0.0.0",9501);


$ws->on("open",function ($ws,$request){
    var_dump ($request);
    $ws->push($request->fd,"welcome\n");
});

$ws->on("message",function ($ws,$request){
    echo "Message: $request->data";
    $ws->push($request->fd ,"get it message");
});

$ws->on("close",function ($ws,$requset){
    echo "close\n";
});

$ws->start();
